package com.wutianyi.module.product.dataobject;

import java.io.Serializable;
import java.util.Date;

import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import com.wutianyi.utils.Utils;

/**
 * @author wutianyi
 * 
 */
public class ProductInfoDO implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1380749202744752237L;
	private transient int id;
	private int productId;
	private String info;
	private Date gmtCreate;
	private Date gmtModified;
	
	public ProductInfoDO() {
		gmtCreate = new Date();
		gmtModified = new Date();
	}
	
	public ProductInfoDO(int productId, String info) {
		this.productId = productId;
		this.info = info;
		gmtCreate = new Date();
		gmtModified = new Date();
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public int getProductId() {
		return productId;
	}
	
	public void setProductId(int productId) {
		this.productId = productId;
	}
	
	public String getInfo() {
		return info;
	}
	
	public void setInfo(String info) {
		this.info = info;
	}
	
	public Date getGmtCreate() {
		return gmtCreate;
	}
	
	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}
	
	public Date getGmtModified() {
		return gmtModified;
	}
	
	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}
	
	public int hashCode() {
		HashFunction hf = Hashing.md5();
		HashCode hc = hf.newHasher().putInt(productId).putString(Utils.stringToString(info)).hash();
		return hc.asInt();
	}
}
